<?php
//截取规定长度的字符串，支持中文截取
function getSubStr(&$object,$field,$length,$encoding,$start = 0){
	//exit();
	if($object){
		if(is_array($object)){
			//只设用于数字下标
			for($i = $start; $i < count($object);$i++){
				if(mb_strlen($object[$i][$field],$encoding) > $length){
					$object[$i][$field] = mb_substr($object[$i][$field],0,$length,$encoding).'...';
				}
			}
		}else{
			if(mb_strlen($object,$encoding) > $length){
				return $object =  mb_substr($object, 0,$length,$encoding).'...';
			}else{
				return $object;
			}
		}
	}
}
?>